package cn.wzvtcsoft.sys.entity;

import cn.wzvtcsoft.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Set;

@Setter
@Getter
@Entity(name = "sys_permission")
public class Permission extends BaseEntity {

  private Long parentId;

  private Integer type;

  private String name;

  private String path;

  private String title;

  @Column(precision = 10, scale = 2)
  private BigDecimal sortOrder;

  @OneToMany(mappedBy = "permission", cascade = CascadeType.REMOVE, orphanRemoval = true)
  @JsonIgnore
  private Set<RolePermission> rolePermissions;

}
